package org.news.web.domain.vo;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import org.news.web.domain.Categories;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@ExcelIgnoreUnannotated
public class CategoriesTreeVo implements Serializable {

    /**
     * 栏目或类别ID
     */
    @ExcelProperty(value = "栏目或类别ID")
    private Long categoryId;


    /**
     * 父栏目ID，用于表示栏目的层级关系

     */
    @ExcelProperty(value = "父栏目ID，用于表示栏目的层级关系 ")
    private Long parentCategoryId;

    /**
     * 用于表达是类别还是栏目
     */
    @ExcelProperty(value = "用于表达是类别还是栏目")
    private Long status;

    /**
     * 内容数量
     */
    @ExcelProperty(value = "内容数量")
    private Long contentCount;

    /**
     * 订阅数量
     */
    @ExcelProperty(value = "订阅数量")
    private Long subscriberCount;

    /**
     * 子节点
     */

    @ExcelProperty(value = "子节点")
    private List<CategoriesTreeVo> childrens;




    public CategoriesTreeVo(Categories root){
        this.status = root.getStatus();
        this.categoryId = root.getCategoryId();
        this.parentCategoryId = root.getParentCategoryId();
        this.subscriberCount = root.getSubscriberCount();
        this.contentCount = root.getContentCount();
    }

    public CategoriesTreeVo(){
        this.setChildrens(new ArrayList<>());
    }
}
